home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_bas / netuser.zip / DATA / VB / NetUser / Netuser.txt
Text File  |  1995-12-18  |  4KB  |  93 lines

  1. Network User Information - Obtain the login name of the person using the system.
  2. Written by:
  3.     Chad Hegerty
  4.         CompuServe:    71212,1045
  5.         MSN:        HegertyC
  6.  
  7. Please see the bottom of this document for version history.
  8.  
  9. This program is donationware. If you find the program useful, and use 
  10. it in your environment, consider sending $10.00 to:
  11.  
  12.     Chad Hegerty
  13.     PO Box 844
  14.     Worthington, OH  43085
  15.  
  16. I'm not trying to make a lot of money off this code, but I have spent 
  17. considerable time in building and testing these code modules. 
  18.  
  19. This ZIP file contains four (4) separate areas. 
  20.  
  21. Three areas are VBA code and the fourth area is an OLE Server area. The VBA code is broken out into the following (the programs listed may not be the only programs able to use these modules):
  22.  
  23.     16-Bit - Used for 16 bit coding environments (Access 2, VB 3 & 4 16-bit, Excel 5, etc.)
  24.     32-Bit - Used for 32 bit coding environments (VB 4 32-bit, Access 7, Excel 7, etc.)
  25.     Conditional - Used in environments where conditional compilation is possible (VB 4.0)
  26.  
  27.     Below is the declaration and function call needed to obtain the logon name.
  28.  
  29.         dim strUserID as string
  30.  
  31.         strUserID = NetworkUserID()
  32.  
  33.     If the user is not signed in or the ID cannot be obtained, then the
  34.     string "UnknownUser" is returned.
  35.  
  36. The OLE Server area contains more detailed information about the computer that the user is signed into. These OLE Servers can return the following information:
  37.         Name - Name of the computer
  38.         User - User of the computer (who is logged in)
  39.         Windows - Directory where Windows is installed
  40.         WinSystem - Directory where Windows SYSTEM is installed
  41.  
  42.     The OLE servers are compiled into the following versions:
  43.         COMPINFO.EXE - 16-bit "out-of-process" OLE server
  44.         COMPINFO32.EXE - 32-bit "out-of-process" OLE server
  45.         COMPINFO32.DLL - 32-bit "in-process" OLE server
  46.  
  47.     To register the EXE servers you need to run the EXE once, this will 
  48.     register the OLE object. You may need to include the OLE 2.0 files 
  49.     if the users machines do not have OLE 2.0 already installed.
  50.  
  51.     Below is the declaration and function call needed for the 
  52.     computer information (for VB and Access, other programs may differ in
  53.     their syntax for calling OLE objects.
  54.  
  55.         dim obj as object
  56.  
  57.         set obj = CreateObject("ComputerInfo.Application")
  58.         debug.print obj.Name
  59.         debug.print obj.User
  60.         debug.print obj.Windows
  61.         debug.print obj.WinSystem
  62.  
  63.     If you are using the 16-bit COMPINFO.EXE, then the Name property will
  64.     return "Unknown". If I get enough response, I will code the computer name
  65.     for the 16-bit OLE server.
  66.  
  67.     Note:     If you have other items about the computer that you think would
  68.         be helpful, drop me an e-mail. I will try to include it in an 
  69.         upcoming release.
  70.  
  71. Note: If the user might be running on Windows 95, or Windows NT, with the 16-bit
  72. versions, then the CALL32.DLL file needs to be included. This file needs to be 
  73. installed in the users SYSTEM directory where they have Windows installed.
  74.  
  75. The CALL32.DLL module, along with its text file, should be included with this file.
  76.  
  77. Please feel free to redistribute these files in their entirety. 
  78.  
  79. No guarantees are made as to its suitability or usefulness.
  80.  
  81. Thank you
  82.  
  83. Chad Hegerty
  84.     Internet:    71212.1045@compueserve.com     - or - 
  85.             HegertyC@MSN.COM
  86.     CompuServe:    71212,1045
  87.     MSN:        HegertyC
  88.  
  89. Version History:
  90.     12/07        Orignial
  91.     12/15        Corrected WNetGetUser return types from 16 bit code. 
  92.             Corrected string trimming to ignore Null character.
  93.     12/18        Corrected Left$ parsing for WFW and Windows 3.x clients.